function columns(edit, onBlur) {
  return [
    {
      field: 'predictAccountDate',
      width: 150,
      header: {
        filter: {
          title: '全款到账日期', 
          key: 'predictAccountDate',
          placeholder: '请选择',
          date: {
            type: 'daterange'
          },
        }
      },
    },
    {
      field: 'accumulateMoney',
      title: '累计回款金额(元)',
      width: 150,
      cell: {
        text: {
          type: 'number'
        }
      }
    },
    {
      field: 'dealRoomDate',
      width: 130,
      header: {
        filter: {
          title: '交房日期', 
          key: 'dealRoomDate',
          placeholder: '请选择',
          date: {
            type: 'daterange'
          },
        }
      },
    },
    {
      field: 'commissionWayStr',
      title: '结佣方式',
      width: 100,
    },
    {
      field: 'settlementAmount',
      title: '本次结算总销(元)',
      width: 150,
      cell: (row) => {
        if (edit) {
          return {
            edit: {
              input: {
                type: 'number',
                error: row.settlementAmountErr,
                blur: (val) => {
                  onBlur(row, 'settlementAmount')
                }
              }
            }
          }
        } else {
          return {
            text: {
              type: 'number'
            }
          }
        }
      }
    },
    {
      field: 'settlementTotalSales',
      title: '已结算总销(元)',
      width: 130,
      cell: {
        text: {
          type: 'number'
        }
      }
    },
    {
      field: 'baseAgentCost',
      title: '本次代理费率',
      width: 150,
      cell: (row) => {
        if (edit) {
          return {
            group: [{
              key: 'baseAgentCost',
              placeholder: '请输入',
              col: 20,
              input: {
                type: 'number',
                error: row.baseAgentCostErr,
                blur: () => {
                  onBlur(row, 'baseAgentCost')
                }
              }
            }, {
              placeholder: row.baseAgentType == '1' ? '%' : '元',
              col: 4,
              text: {}
            }]
          }
        } else {
          return {
            value: (row) => `${row.baseAgentCost}${row.baseAgentType == '1' ? '%' : '元'}`,
            text: {}
          }
        }
      }
    },
    {
      field: 'contractPer',
      title: '签约比例(%)',
      width: 130,
      cell: {
        value: (row) => row.contractPer ? `${Number(row.contractPer)}` : '',
        text: {}
      }
    },
    {
      field: 'depositPer',
      title: '保证金比例(%)',
      width: 130,
      cell: {
        value: (row) => row.depositPer ? `${Number(row.depositPer)}` : '',
        text: {}
      }
    },
    {
      field: 'depositAmount',
      title: '保证金(元)',
      width: 130,
      cell: () => {
        return {
          value: (row) => row.depositAmount == 0 ? '0.00' : row.depositAmount,
          text: {
            type: 'number'
          }
        }
      }
    },
    {
      field: 'reduceAmount',
      title: '关系户扣减(元)',
      width: 130,
      cell: () => {
        return {
          value: (row) => row.reduceAmount == 0 ? '0.00' : row.reduceAmount,
          text: {
            type: 'number'
          }
        }
      }
    },
    {
      field: 'shouldAgentCost',
      title: '本次应结代理费(元)',
      width: 160,
      cell: () => {
        return {
          value: (row) => row.shouldAgentCost == 0 ? '0.00' : row.shouldAgentCost,
          text: {
            type: 'number'
          }
        }
      }
    },
    {
      field: 'settledAgentCost',
      title: '已结算代理费(元)',
      width: 150,
      cell: {
        text: {
          type: 'number'
        }
      }
    },
  ]
}

export default {
  columns
}
